self reference a class with typing.Self (python)
- description
- No value
- aliases
- No value
- tags
- No value
- created
- 2023-05-17T13:06:04
- updated
- 2023-07-15T21:33:03
- title
- self reference a class with typing.Self (python)
해결방안: typing.Self를 사용하면 된다. 다만, python3.11이상 버전에서만 된다는거 알고가셈.
python version < 3.11인 경우에도 해결방안이 존재하긴 하다. typing-extensions 패키지를 설치하여 from typing_extensions import Self하면 된다.